﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DataLayer.Database;

namespace WinProgProject2
{
    public partial class LogGoruntuleme : Form
    {
        int index = 0;
        public LogGoruntuleme()
        {
            InitializeComponent();
        }

        private void cmbLogTuru_SelectedIndexChanged(object sender, EventArgs e)
        {
            islemTuruBelirle(cmbLogTuru.SelectedIndex);
        }

        private void islemTuruBelirle(int seciliIndex)
        {
            index = seciliIndex;
            switch (index)
            { 
                case 5:
                    cmbIslemTuru.Items.Add("Rezervasyon Bitir");
                    break;
                case 6:
                    cmbIslemTuru.Items.Clear();
                    cmbIslemTuru.Items.AddRange(new string[] {"Başarısız","Başarılı"});
                    break;
                case 7:
                    cmbIslemTuru.Enabled = false;
                    break;

            }
        }

        private void LogGoruntuleme_Load(object sender, EventArgs e)
        {
            try
            {
                cmbIslemTuru.SelectedIndex = 0;
                cmbLogTuru.SelectedIndex = 0;
            }catch
            {
            
            }
        }

        private void cmbIslemTuru_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void btnGoster_Click(object sender, EventArgs e)
        {
            switch (index)
            {
                case 7:
                    ErrorLogService.Service1Client svc = new ErrorLogService.Service1Client();
                    dgwLog.DataSource = svc.errorListele();
                    break;
            }
            //ErrorLogService.Service1Client svc = new ErrorLogService.Service1Client();
            //dgwLog.DataSource = svc.LogCek(cmbLogTuru.SelectedIndex, dtBaslangic.Value, dtBitis.Value, cmbIslemTuru.SelectedIndex+1);
        }
    }
}
